<template>
  <div>
    <h1>编辑课程分类</h1>
    <el-row  :gutter="20">
      <el-col :span="12"></el-col>
      <el-col :span="12"><div>
        *分类名称：<el-input v-model="input" placeholder="请输入" style="width: 30%"></el-input>
      </div></el-col>
    </el-row>
    <p>输入的内容为(数据双向绑定)：{{input}}</p>
    <el-row>
      <el-button @click="myback" >取消</el-button>
      <el-button @click="myclick" type="primary">确定</el-button>
    </el-row>
  </div>
</template>

<script>
    import { patchcategory } from '@/api/course'
    export default {
      name: 'editrcouserclass',
      data() {
        return {
          input: ''
        }
      },
      methods: {
        myback() {
          this.$router.push({ name: 'couserclassmanager' })
        },
        myclick() {
          var subject_name = this.input
          var subject_id = this.$route.params.id
          patchcategory(subject_id, subject_name).then(response => {
            const data = response.data
            console.log(data)
            this.$router.push({ name: 'couserclassmanager' })
          }).catch(error => {
            console.log(error)
          })
        }
      },
      created: function() {
        this.input = this.$route.params.name
      }
    }
</script>

<style scoped>

</style>
